package zb.fix.entity;

import lombok.AllArgsConstructor;
import quickfix.FieldNotFound;
import quickfix.Message;
import quickfix.field.OrdType;
import quickfix.field.OrderQty;
import quickfix.field.Price;
import quickfix.field.Side;
import quickfix.field.Symbol;

@AllArgsConstructor
public class FixEntityKit {
	private Message message;
	
	public OrderEntity convertOrder() {
		OrderEntity order = new OrderEntity();
		try {
			order.setSymbol(message.getString(Symbol.FIELD));
			order.setOrderType(message.getInt(OrdType.FIELD));
			order.setSide(message.getInt(Side.FIELD));
			order.setPrice(message.getDecimal(Price.FIELD));
			order.setOrderQty(message.getDecimal(OrderQty.FIELD));
		} catch (FieldNotFound e) {
			e.printStackTrace();
		}
		return order;
	}
}
